package p.sglmsn.top.ext.wx.task;

import cn.hutool.cache.impl.TimedCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import p.sglmsn.top.ext.wx.enums.MethodEnum;
import p.sglmsn.top.ext.wx.wxext.http.SendDto;

import java.math.BigInteger;

@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
@Slf4j
@Component
public class Timer {


    /**
     * 整数的缓存
     */
    static final TimedCache<BigInteger, String> INTEGER_TIMED_CACHE = new TimedCache<>(1000 * 60 * 30);


    /**
     * 任务的登录账户
     */
    @Scheduled(fixedDelay = 1000 * 30)
    public void taskLoginAccount() {
        try {
            MethodEnum.获取登录信息.exec(new SendDto());
        } catch (Exception e) {

        }
    }


}
